import math
def isright(n):
    k=list(str(n))
    if k[2]!=k[3]:
        return 0
    if int(math.sqrt(n))!=math.sqrt(n):
        return 0
    return 1
for i in range(1,10):
    for j in range(1,10):
        for m in range(1,10):
            n=i*1000+j*100+m*10+m
            if isright(n)==1:
                print n